<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    class Rectangle{
      constructor(x,y,width,height){
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
      }
      // set position(value){

      // }
      get position(){
        return {x:this.x,y:this.y}
      }
      get size(){
        return {width:this.width,height:this.height}
      }
    }
    var rec1 = new Rectangle(10,20,100,200)
    console.log(rec1.position) //{x:10,y:20}
    console.log(rec1.size)
  </script>
</body>
</html>